<template>
  <!-- 水量报表 -->
  <div class="FlWaterMeterRecord">
    <button class="leftTreetitleButton" @click="treeShowOrClose = true" v-if="!treeShowOrClose">
      <i class="el-icon-caret-right"></i>
    </button>
    <div class="leftTree" v-if="treeShowOrClose">
      <!-- 树形图 -->
      <!-- <leftTree></leftTree> -->
      <waterMeterLeftTree class="waterMeterLeftTree" @clickClose='clickClose' @areaIf='areaIf' />
    </div>
    <div :class="[{rightcontant:treeShowOrClose},{rightcontant2:!treeShowOrClose}]">
      <!-- 搜索框-->
      <div class="searchDataTop" style="display:flex;">
        <searchComponents :searchData="searchData" :optionsZi="optionsZi" :searchOptionTable="searchOptionTable" @searchCallBack="searchCallBack"></searchComponents>
        <!-- 搜索按钮 -->

        <!-- style="float:right;padding:10px;" -->
        <div>
          <!-- class="rightButtons" -->
          <el-button type="primary" size="mini" plain @click="sunS_F" icon="el-icon-search" style="margin-top:35px;">搜索</el-button>

        </div>
      </div>

      <!-- {{suoS}} -->
      <!-- <div style="padding: 0px 0px;"> -->
      <!-- <div style="border-top:1px solid #E6E6E6;margin:0px 20px;"></div> -->
      <!-- @clearSearch='clearSearch' -->
      <!-- <div style="border-top:1px solid #E6E6E6;margin:0px 20px;"></div> -->
      <!-- <div class="right_row" style="padding: 25px 30px;"> -->
      <!--添加和批量删除组件-->
      <!-- <buttonhurdle
              class="buttonhurdle"
              :diaDataAdd="searchData"
              :optionsZi="optionsZi"
              :searchOptionTable="searchOptionTable"
              @toAdd="toAdd"
              @toDelete="toDelete"
          ></buttonhurdle> -->
      <!-- 模板导入导出下载 -->
      <!-- <importXlsx
            class="importX"
            :importUrl='importUrl'
            :suoS='suoS'
            :multipleSelection='multipleSelection'
          /> -->
      <!-- <rightButtons
            style="float:right;padding:10px;"
            @sunS_F='sunS_F'
            @emptySearch='emptySearch'
            @configuration='configuration'
            class="right_buttons"
          ></rightButtons> -->
      <!-- </div>
      </div> -->
      <!-- 表格 -->
      <div class="out">
        <!--数据列表-->
        <!-- 字典 -->
        <dictionaries :searchData='searchData' :modelType='modelType' @optionData="dictionariesCallBack"></dictionaries>
        <el-table ref="multipleTable" :data="dataAttribute" v-loading.body="false" border fit highlight-current-row size="mini" :cell-style="{padding:'5px 0'}" @selection-change="handleSelectionChange">
          <!-- show-summary -->
          <el-table-column align="center" type="selection" :show-overflow-tooltip="true" width="55"></el-table-column>
          <el-table-column fixed align="center" label="序号" type="index" :index="indexMethod" width="50">
          </el-table-column>
          <el-table-column fixed prop="userCode" label="用户号" align="center" :show-overflow-tooltip="true" width="100"></el-table-column>
          <el-table-column fixed prop="waterNo" label="表身号" align="center" :show-overflow-tooltip="true" width="100"></el-table-column>
          <el-table-column fixed prop="setupAddress" label="用水地址" align="center" :show-overflow-tooltip="true" width="200"></el-table-column>
          <el-table-column align="center" v-for="item in searchData" v-if="item.tableSign" :key="item.id" :label="item.CN" :show-overflow-tooltip="true">
            <template slot-scope="scope">{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</template>
          </el-table-column>
          <el-table-column fixed="right" prop="AvTolNum" label="平均值" align="center" :show-overflow-tooltip="true" width="150"></el-table-column>
          <el-table-column fixed="right" prop="TolNum" label="合计" align="center" :show-overflow-tooltip="true" width="150"></el-table-column>
          <!-- width="200px" -->
          <!-- <el-table-column align="center" label="操作" width="280px" fixed="right">
            <template slot-scope="scope" class="do">
              <el-button
                style="color:#0B9AC3;border:none;"
                icon="el-icon-view"
                circle
                @click="makeExaId(scope.row.id)"
              ></el-button>
              <modificationi
                class="inline_block"
                :attributeOrder="searchData"
                :optionsZi="optionsZi"
                :searchOptionTable="searchOptionTable"
                :modData="scope.row"
                @modifyData="modifyData"
              ></modificationi>
              <el-button
                style="color:#C90010;border:none;"
                icon="el-icon-delete"
                circle
                @click="deleteList(scope.row.id)"
              ></el-button>
            </template>
          </el-table-column> -->
        </el-table>
        <el-pagination class="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="pagetotal"></el-pagination>
      </div>

    </div>

    <!-- 查看组件 -->
    <examine :DialogVisibleMod="DialogVisibleExamine" :modData="examineData" :optionsZi="optionsZi" :searchOptionTable="searchOptionTable" :attributeOrder="searchData" @examineDialog="examineDialog"></examine>
  </div>
</template>
<script>
//引入组件
import {
  SearchCForL,
  searchComponents,
  buttonhurdle,
  modificationi,
  waterMeterLeftTree,
  examine,
  rightButtons,
  dictionaries,
  importXlsx,
} from '@/views/components/FLPage'
import {
  addFlWaterMeterRecord, //增加
  deleteFlWaterMeterRecord, //删除
  searchFlWaterMeterRecord, //分页查询
  modifyFlWaterMeterRecord, //修改
  getFlWaterMeterRecord, //根据ID获取
  exprotXls, //导出xlsx数据
  downTem, //导出下载模板
  getDaily2, //日报二次处理
} from '@/api/waterAnalysis/flWaterReport/index'
export default {
  components: {
    buttonhurdle,
    modificationi,
    waterMeterLeftTree,
    examine,
    searchComponents,
    importXlsx,
    rightButtons,
    dictionaries,
  },
  name: 'FlWaterMeterRecord',
  data() {
    return {
      importUrl: `/api/cb/flWaterMeterRecord/importXls`,
      //搜索框
      suoS: {},
      treeShowOrClose: false,
      //   搜索组件的数据
      searchData: [
        {
          EN: 'id',
          CN: 'id',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'readNumDate',
          CN: '开始时间',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: false,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },

        {
          EN: 'lastNumDate',
          CN: '结束时间',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },
        {
          EN: 'userCode',
          CN: '用户号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'waterNo',
          CN: '表身号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'setupAddress',
          CN: '用水地址',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          typeGroupCode: 'meterread_type',
          result: true,
          sign: true,
          searchSign: false,
          addSign: false,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },
        {
          EN: 'readType',
          CN: '抄表方式',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          typeGroupCode: 'meterread_type',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        // {
        //   EN: "lastNumDate",
        //   CN: "上期抄表日期",
        //   value: "",
        //   type: "date",
        //   option: [],
        //   Exp: "^.{3,20}$",
        //   err: "长度为3-20的所有字符!",
        //   result: true,
        //   sign: true,
        //   searchSign: false,
        //   addSign: true,
        //   tableSign: false,
        //   examineSign: true,
        //   examineDisabled: false,
        //   modificationSign: true
        // },
        {
          EN: 'lastNum',
          CN: '上期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        // {
        //   EN: "readNumDate",
        //   CN: "本期抄表日期",
        //   value: "",
        //   type: "date",
        //   option: [],
        //   Exp: "^.{3,20}$",
        //   err: "长度为3-20的所有字符!",
        //   result: true,
        //   sign: true,
        //   searchSign: false,
        //   addSign: true,
        //   tableSign: false,
        //   examineSign: true,
        //   examineDisabled: false,
        //   modificationSign: true
        // },
        {
          EN: 'dayCount',
          CN: '跨越天数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'readNum',
          CN: '当期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'useCount',
          CN: '用水量',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'freeingData',
          CN: '缓存数据',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'freeingDate',
          CN: '缓存日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'tapsatatus',
          CN: '阀门状态',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'addresscode',
          CN: '表计地址码',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'signalintensity',
          CN: '信号强度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'imei',
          CN: 'IMEI',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'batterystatus',
          CN: '电池状态',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'version',
          CN: '版本号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'cycleOfUpload',
          CN: 'NB表读数上报周期',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'AvTolNum',
          CN: '平均值',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'TolNum',
          CN: '合计',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
      ],
      //   搜索组件的数据
      searchDataDong: [
        {
          EN: 'id',
          CN: 'id',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'readNumDate',
          CN: '开始时间',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: false,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },

        {
          EN: 'lastNumDate',
          CN: '结束时间',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },
        {
          EN: 'userCode',
          CN: '用户号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'waterNo',
          CN: '表身号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'setupAddress',
          CN: '用水地址',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          typeGroupCode: 'meterread_type',
          result: true,
          sign: true,
          searchSign: false,
          addSign: false,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },
        {
          EN: 'readType',
          CN: '抄表方式',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          typeGroupCode: 'meterread_type',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        // {
        //   EN: "lastNumDate",
        //   CN: "上期抄表日期",
        //   value: "",
        //   type: "date",
        //   option: [],
        //   Exp: "^.{3,20}$",
        //   err: "长度为3-20的所有字符!",
        //   result: true,
        //   sign: true,
        //   searchSign: false,
        //   addSign: true,
        //   tableSign: false,
        //   examineSign: true,
        //   examineDisabled: false,
        //   modificationSign: true
        // },
        {
          EN: 'lastNum',
          CN: '上期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        // {
        //   EN: "readNumDate",
        //   CN: "本期抄表日期",
        //   value: "",
        //   type: "date",
        //   option: [],
        //   Exp: "^.{3,20}$",
        //   err: "长度为3-20的所有字符!",
        //   result: true,
        //   sign: true,
        //   searchSign: false,
        //   addSign: true,
        //   tableSign: false,
        //   examineSign: true,
        //   examineDisabled: false,
        //   modificationSign: true
        // },
        {
          EN: 'dayCount',
          CN: '跨越天数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'readNum',
          CN: '当期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'useCount',
          CN: '用水量',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'freeingData',
          CN: '缓存数据',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'freeingDate',
          CN: '缓存日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'tapsatatus',
          CN: '阀门状态',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'addresscode',
          CN: '表计地址码',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'signalintensity',
          CN: '信号强度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'imei',
          CN: 'IMEI',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'batterystatus',
          CN: '电池状态',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'version',
          CN: '版本号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'cycleOfUpload',
          CN: 'NB表读数上报周期',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'AvTolNum',
          CN: '平均值',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        {
          EN: 'TolNum',
          CN: '合计',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
      ],

      //添加弹窗的数据模型
      diaDataAdd: {
        yyqName: '',
        pqName: '',
        pqNum: '',
        BH: '',
      },
      //删除----Start--------------------------------------
      deleteDataList: [],
      //删除----End----------------------------------------

      //查看----Start--------------------------------------

      //查看的弹窗控制器
      DialogVisibleExamine: false,

      //查看的数据
      examineData: {},

      //查看----End----------------------------------------

      //表格数据
      //后端传来的数据
      dataAttribute: [],
      //表格选中
      multipleSelection: [],
      //分页
      currentPage: 1, //当前页
      pagesize: 10, //每页条数
      pagetotal: 0, //总条数,
      modelType: 'table',
      optionsZi: [],
      searchOptionTable: [],
    }
  },
  computed: {
    optionDatas() {
      return function (arr, val) {
        if (arr) {
          for (let i = 0; i < arr.length; i++) {
            if (arr[i].value == val) {
              return arr[i].label
            }
          }
        }
      }
    },
  },
  created() {
    // this.ceshidongtai()
    // this.forData(this.currentPage, this.pagesize, this.suoS);
  },
  methods: {
    // 左侧小区条件
    areaIf(areaCode) {
      console.log(areaCode)
      this.areaCode = areaCode
      this.currentPage = 1
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    clickClose(res) {
      // console.log(res,999);
      if (res === '点击隐藏') {
        this.treeShowOrClose = false
      }
    },
    // 搜索栏清空
    // clearSearch(msg){
    //   if (msg == '清空') {
    //   console.log(msg,'父组件');
    //   this.forData(this.currentPage, this.pagesize); //刷新列表
    //   }
    // },
    // 配置
    configuration(msg) {
      if (msg == '配置') {
        console.log(msg)
      }
    },
    // 重置
    emptySearch(msg) {
      if (msg == '重置') {
        this.currentPage = 1
        this.searchContent = undefined
        // this.forData(this.currentPage, this.pagesize);
      }
    },
    // 字典组件回调
    dictionariesCallBack([a = {}, b = {}]) {
      // 正常字典
      this.optionsZi = a
      // 跨表字典
      this.searchOptionTable = b
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    //搜索
    sunS_F(msg) {
      this.currentPage = 1
      this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
    },
    //查询组件回调
    searchCallBack(newData) {
      // console.log(newData,'查询组件回调');
      let obj = {}
      for (let i = 0; i < newData.length; i++) {
        obj[newData[i].EN] = newData[i].value
        // console.log(newData[i].EN,newData[i].value,666666666);
      }
      console.log(obj)
      this.suoS = obj
    },
    // async ceshidongtai(){
    //   let obj = {date:['2020-05-01','2020-05-02'],value:['55','66']}
    //   let dateTime = obj.date
    //   let valueArr = obj.value
    //   let searchObj = {}
    //   for (let i = 0; i < dateTime.length; i++) {
    //     const element = dateTime[i];
    //     searchObj['EN'] = element
    //     searchObj['CN'] = element
    //     searchObj['value'] = ''
    //     this.searchData.push(searchObj)
    //     searchObj = {}
    //   }

    // },
    // 动态添加searchData数组
    async DynamicallyAddSearchData(page, size, suoS) {
      let searchDataArr = this.searchDataDong
      // let suoS = this.suoS
      // console.log(suoS,'条件');

      const res = await getDaily2(page, size, suoS)
      console.log(res, '二次请求结2222果')
      // 请求返回数组
      let DateList = res.data.list[0]
      console.log(DateList, '二次请求结果')
      let dateTimeList = DateList[0].readNumDate
      // console.log(dateTimeList,'二次请求结果');
      let searchArr = []
      let searchObj = {}
      for (let i = 0; i < dateTimeList.length; i++) {
        const element = dateTimeList[i]
        searchObj['EN'] = element
        searchObj['CN'] = element
        searchObj['value'] = ''
        searchObj['tableSign'] = true
        searchArr.push(searchObj)
        searchObj = {}
      }
      this.searchData = [...searchDataArr, ...searchArr]

      // ---------------------------------------------------
      // 模拟返回的请求数据
      for (let j = 0; j < DateList.length; j++) {
        let everyItem = DateList[j]
        // 所有日期
        let dateName = everyItem.readNumDate
        // 对应所有用水量
        let useCountNumList = everyItem.useCount
        for (let k = 0; k < dateName.length; k++) {
          const elementDate = dateName[k]
          // console.log(elementDate,useCountNumList);
          DateList[j][elementDate] = useCountNumList[k]
          // DateList[j].elementDate = useCountNumList[k]
        }
        // console.log(DateList);
      }
      this.pagetotal = res.data.total
      this.dataAttribute = DateList

      // let obj = {date:['2020-05-01','2020-05-02'],value:['55','66']}
      // let dateTime = obj.date
      // let valueArr = obj.value
      // let searchDataArr = this.searchData
      // let searchObj = {}
      // let searchArr = []
      // for (let i = 0; i < dateTime.length; i++) {
      //   const element = dateTime[i];
      //   searchObj['EN'] = element
      //   searchObj['CN'] = element
      //   searchObj['value'] = ''
      //   searchObj['tableSign'] = true
      //   searchArr.push(searchObj)
      //   searchObj = {}
      // }
      // this.searchData = [...searchDataArr,...searchArr]
    },
    //渲染数据初始
    forData(page, size, searchData) {
      this.DynamicallyAddSearchData(page, size, searchData)
      // searchFlWaterMeterRecord(page, size, searchData).then(response => {
      //   this.pagetotal = response.data.total;
      //   this.dataAttribute = response.data.list;
      // });
    },
    //添加用户--新增表单组件传来的参数
    toAdd(addData) {
      let obj = {}
      for (let i = 0; i < addData.length; i++) {
        obj[addData[i].EN] = addData[i].value
      }
      addFlWaterMeterRecord(obj)
        .then((response) => {
          this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
          this.$message({
            message: '添加成功',
            type: 'success',
          })
        })
        .catch(() => {
          this.$message.error('添加失败')
        })
    },
    //按钮栏传递了删除命令
    toDelete(orderstring) {
      this.$confirm('确认删除？')
        .then((_) => {
          let idArr = []
          for (let i = 0; i < this.deleteDataList.length; i++) {
            idArr.push(this.deleteDataList[i].id)
          }
          if (idArr.length == 0) {
            this.$message({
              message: '请选择要删除的数据',
              type: 'warning',
            })
            return
          }
          deleteFlWaterMeterRecord(idArr)
            .then((response) => {
              this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
              this.$message({
                message: '删除成功',
                type: 'success',
              })
            })
            .catch((error) => {
              this.$message({
                message: '删除失败',
                type: 'warning',
              })
            })
        })
        .catch((_) => {})
    },
    //单项删除
    deleteList(id) {
      let arrId = [id]
      this.$confirm('确认删除？')
        .then((_) => {
          deleteFlWaterMeterRecord(arrId).then((response) => {
            this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
            this.$message({
              message: '删除成功',
              type: 'success',
            })
          })
          done()
        })
        .catch((_) => {})
    },
    //查看
    makeExaId(id) {
      getFlWaterMeterRecord(id)
        .then((response) => {
          let copyDialog = true
          this.DialogVisibleExamine = copyDialog
          // console.log(response);
          this.examineData = response.data
        })
        .catch((error) => {
          alert('获取失败')
        })
    },
    //查看关闭弹窗
    examineDialog(dialogVisibleMod) {
      this.DialogVisibleExamine = false
    },

    //修改
    modifyData(value, modData) {
      if (value) {
        let id = modData.id
        modifyFlWaterMeterRecord(id, modData)
          .then((response) => {
            this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
          })
          .catch((error) => {
            this.$message({
              message: '修改失败',
              type: 'warning',
            })
            this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
          })
      } else {
        this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
      }
    },
    //表格选中事件
    handleSelectionChange(val) {
      this.multipleSelection = val
      //传递删除的参数
      this.deleteDataList = val
    },

    //分页
    handleSizeChange(val) {
      console.log('每页 ' + val + ' 条')
      this.pagesize = val
      this.forData(this.currentPage, val, this.suoS)
    },
    handleCurrentChange(val) {
      console.log('当前页: ' + val)
      this.currentPage = val
      this.forData(val, this.pagesize, this.suoS)
    },
    // 序号
    indexMethod(index) {
      var currentPage = this.currentPage
      var pagesize = this.pagesize
      this.$nextTick(function () {
        currentPage = this.currentPage
        pagesize = this.pagesize
      })
      return currentPage * pagesize - pagesize + 1 + index
    },
    // 下载模板请求
    exprotXlsx: exprotXls,
    downloadFile: downTem,
    //工具栏组件传来的参数
    // FTableFunction(attributeOrderCloneTwiceL) {
    //   this.attributeOrder = attributeOrderCloneTwiceL;
    // },
  },
}
</script>
<style scoped src="@/styles/allCss.css"></style>
<style lang="scss" scoped>
.FlWaterMeterRecord {
  display: flex;
  .leftTreetitleButton {
    margin-top: 10px;
    border: 0;
    height: 32px;
  }
  .leftTree {
    width: 14.2%;
    .waterMeterLeftTree {
      border: 1px soild #ccc;
    }
  }
  .rightcontant {
    width: 85.8%;
    /deep/ .el-table--mini {
      .gutter {
        display: table-cell !important;
      }
      /deep/.el-table__body-wrapper {
        .el-table__body {
          tbody {
            /deep/.el-table__row {
              height: 47px !important;
              line-height: 47px !important;
              .is-center {
                .cell {
                  height: 47px !important;
                  line-height: 47px !important;
                }
              }
            }
            // .current-row{
            //   .is-center{
            //     height: 47px !important;
            //   }
            // }
          }
        }
      }
      /deep/.el-table__fixed-right {
        .el-table__body {
          tbody {
            /deep/.el-table__row {
              height: 47px !important;
              line-height: 47px !important;
              .is-center {
                .cell {
                  height: 47px !important;
                  line-height: 47px !important;
                }
              }
            }
            // .current-row{
            //   .is-center{
            //     height: 47px !important;
            //   }
            // }
          }
        }
      }
      /deep/.el-table__fixed {
        .el-table__body {
          tbody {
            /deep/.el-table__row {
              height: 47px !important;
              line-height: 47px !important;
              .is-center {
                .cell {
                  height: 47px !important;
                  line-height: 47px !important;
                }
              }
            }
            // .current-row{
            //   .is-center{
            //     height: 47px !important;
            //   }
            // }
          }
        }
      }
    }
    .buttonTop {
      // display: flex;
      // flex-direction: row;
      // justify-content: space-between;
      // align-items: center;
      position: relative;
      .rightButtons {
        position: absolute;
        right: 0;
        padding-left: 50px;
        display: flex;
        flex-direction: row;
        justify-content: end;
        width: 300px;
      }
      // .hunt_sunS_F{
      //   float: right;
      //   margin: 10px;
      // }
    }
    .do {
      display: flex;
    }
    .pagination {
      margin-top: 15px;
    }
  }
  .rightcontant2 {
    width: 97%;
    /deep/ .el-table--mini {
      .gutter {
        display: table-cell !important;
      }
      /deep/.el-table__body-wrapper {
        .el-table__body {
          tbody {
            /deep/.el-table__row {
              height: 47px !important;
              line-height: 47px !important;
              .is-center {
                .cell {
                  height: 47px !important;
                  line-height: 47px !important;
                }
              }
            }
            // .current-row{
            //   .is-center{
            //     height: 47px !important;
            //   }
            // }
          }
        }
      }
      /deep/.el-table__fixed-right {
        .el-table__body {
          tbody {
            /deep/.el-table__row {
              height: 47px !important;
              .is-center {
                .cell {
                  height: 47px !important;
                }
              }
            }
            // .current-row{
            //   .is-center{
            //     height: 47px !important;
            //   }
            // }
          }
        }
      }
      /deep/.el-table__fixed {
        .el-table__body {
          tbody {
            /deep/.el-table__row {
              height: 47px !important;
              line-height: 47px !important;
              .is-center {
                .cell {
                  height: 47px !important;
                  line-height: 47px !important;
                }
              }
            }
            // .current-row{
            //   .is-center{
            //     height: 47px !important;
            //   }
            // }
          }
        }
      }
    }
    .buttonTop {
      // display: flex;
      // flex-direction: row;
      // justify-content: space-between;
      // align-items: center;
      position: relative;
      .is-plain {
        position: absolute;
        right: 0;
        padding-left: 50px;
        width: 300px;
      }
    }
    .do {
      display: flex;
    }
    .pagination {
      text-align: left;
      margin-top: 15px;
    }
  }
}
</style>
